﻿/*include:js\declare*/
//文件选择自定义界面	<input type="file" id="YYY" /><div fileclicker="{FileId:'YYY'}" id="XXX"></div>
(function(){
var FileClicker=function()
	{
	this.GetArgument(arguments[0],{Id:null,Event:null,FileId:null},1);
	this.Start(this.Event||{IsGetOnly:1});
	};
(fastCSharp.Functions.FileClicker=FileClicker).Inherit(fastCSharp.BaseFunction,{
Start:function(Event)
	{
	if(!Event.IsGetOnly)
		{
		var Element=fastCSharp.$Id(this.Id),Input=Element.Element();
		if(Input!=this.Element)
			{
			this.Element=Input;
			Element.AddEvent('mousemove,mouseover',fastCSharp.ThisEvent(this,this.Move));
			fastCSharp.$Id(this.FileId).Css('outline','0px').Set('FILECLICKER','{Id:"'+this.Id+'"}').AddEvent('mousemove,mouseover',fastCSharp.ThisEvent(this,this.Move));
			this.SetCss();
			}
		}
	},
SetCss:function()
	{
	this.$Id(this.Id).Cursor('pointer');
	this.$Id(this.FileId).Opacity(0).Css('position','absolute').Display(0).Set('size',1).Cursor('pointer');
	},
Move:function(Event)
	{
	this.$Id(this.FileId).Css('left',(Event.clientX-80)+'px').Css('top',(Event.clientY-8)+'px').Display(1);
	}
//,NewInput:function()
//	{
//	var Input=this.$Id(this.Id);
//	Input.Replace(fastCSharp.$Create('input').Set('type','file').Name(this.FileId).Id(this.FileId).Set('onchange',Input.Element().onchange));
//	this.SetCss();
//	}
		});
new fastCSharp.Declare('FileClicker','mouseover','ParameterId');
})();
